<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <table border="1">
    <tbody>
      <tr>
        <td class="bgc">1-1</td>
        <td>2-1</td>
        <td>3-1</td>
        <td>4-1</td>
      </tr>
      <tr>
        <td>1-2</td>
        <td class="bgc">2-2</td>
        <td>3-2</td>
        <td>4-2</td>
      </tr>
      <tr>
        <td>1-3</td>
        <td>2-3</td>
        <td class="bgc">3-3</td>
        <td>4-3</td>
      </tr>
      <tr>
        <td>1-4</td>
        <td>2-4</td>
        <td>3-4</td>
        <td class="bgc">4-4</td>
      </tr>
    </tbody>
  </table>
</body>
<script>
   var el = document.getElementsByClassName('bgc')
    console.log(el);
    for (var i = 0; i < el.length; i++){
      el[i].style.backgroundColor = 'red';
    }
</script>
</html>